package org.infoset.xml;

import java.net.*;


/**
 *
 * @author  R. Alexander Milowski
 */
public interface ItemConstructor {

   Infoset getInfoset();
   
   Attribute createAttribute(Name name, String value);
   
   /**
    * Creates a parentless element.
    * @param name The name of the element to create.
    * @return An element instance.
    */
   Element createElement(Name name)
      throws XMLException;

   /**
    * Creates an element end event.
    * @param name The name of end element.
    */
   ElementEnd createElementEnd(Name name)
      throws XMLException;
   
   /**
    * Creates an element end event.
    * @param startElement The element with the same name as the name of end element.
    */
   ElementEnd createElementEnd(Element startElement)
      throws XMLException;
   
   /**
    * Creates a document without a document element with the specified base URI.
    * @param base The base URI (e.g. location) of the document to create.
    * @return A document instance.
    */
   Document createDocument(URI base)
      throws XMLException;

   /**
    * Creates a document without a document element or base URI.
    * @return A document instance.
    */
   Document createDocument()
      throws XMLException;
   
   /**
    * Creates a document end event.
    */
   DocumentEnd createDocumentEnd()
      throws XMLException;
   
   /**
    * Creates a parentless data child item.
    * @param value The value for the data item.
    * @return A Child that is also a Data item.
    */
   Characters createCharacters(String value)
      throws XMLException;
   
   /**
    * Creates a parentless data child item.
    * @param value The value for the data item.
    * @return A Child that is also a Data item.
    */
   Characters createCharacters(char [] value,int start,int len)
      throws XMLException;
   
   ProcessingInstruction createProcessingInstruction(Name name,String value)
      throws XMLException;
   
   ProcessingInstruction createProcessingInstruction(Name name,char [] value, int start, int len)
      throws XMLException;
   
   Comment createComment(String value)
      throws XMLException;
   
   Comment createComment(char [] value, int start, int len)
      throws XMLException;
   
   Sequence createSequence()
      throws XMLException;
   
   SequenceEnd createSequenceEnd()
      throws XMLException;
   
   Value createValue(Object value)
      throws XMLException;
   
   Value createValue(Object value, String lexicalValue, TypeDefinition typeDef)
      throws XMLException;
   
}
